﻿using System;
using System.Configuration;
using System.Data;
using MySql.Data.MySqlClient;

namespace Erebo
{
    public class Conexion
    {
        public Conexion()
        { }
        public static String ConnectionString()
        {
            ConnectionStringSettings conn= ConfigurationManager.ConnectionStrings["connMySQL"];
            return conn.ConnectionString;
            
        }

        public DataTable test()
        {
            MySqlConnection conn = new MySqlConnection(Conexion.ConnectionString());
            conn.Open();

            MySqlCommand cmd = conn.CreateCommand();
            cmd.CommandText = "select * from usuario";
            cmd.CommandType = CommandType.Text;

            MySqlDataAdapter da = new MySqlDataAdapter(cmd);
            DataTable dt = new DataTable();
            da.Fill(dt);

            conn.Close();
            return dt;
        }
    }
}